package org.nepu.scr.indexrate.converter.drillingrate.jobsupport;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.drillingrate.jobsupport.PlatformLodging;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class PlatformLodgingConverter implements AttributeConverter<PlatformLodging, String> {
    @Override
    public String convertToDatabaseColumn(PlatformLodging platformLodging) {
        return JSONUtil.toJsonStr(platformLodging);
    }

    @Override
    public PlatformLodging convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, PlatformLodging.class);
    }
}
